home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13966 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: ix.netcom.com!news
  2. From: bellew@ix.netcom.com (Leo Bellew)
  3. Newsgroups: comp.lang.eiffel,comp.lang.c,comp.lang.c++,comp.object,comp.software-eng
  4. Subject: Re: Portability of code & skills (Beware of "C" Hackers etc)
  5. Date: Thu, 28 Mar 1996 05:08:56 GMT
  6. Organization: Netcom
  7. Message-ID: <3159f68e.43678384@nntp.ix.netcom.com>
  8. References: <31494D29.4D4B@dmu.ac.uk> <DoG3HE.48E@assip.csasyd.oz>     <31517E6F.5930@dmu.ac.uk> <DooBwC.8C0@world.std.com> <65O34-3-3RB@herold.franken.de> <4j8177$18ma@saba.info.ucla.edu>
  9. Reply-To: bellew@ix.netcom.com
  10. NNTP-Posting-Host: phi-pa6-10.ix.netcom.com
  11. X-NETCOM-Date: Wed Mar 27 11:14:34 PM CST 1996
  12. X-Newsreader: Forte Agent .99d/32.182
  13.  
  14. Now, now. COBOL uses *all* global variables, and it has never been
  15. accused of being an ivory tower idea from CS, which you seemed to be
  16. implying. In Pascal, the use of global variables is not a side-effect
  17. but rather a central-effect. It is in no way an afterthought or a
  18. hidden or unanticipated effect. Whether it is good practice or not,
  19. that is a question I have given up on answering many years ago.  You
  20. have a lot of company in considering global variable harmful, though.
  21.  
  22. Leo
  23.  
  24. On 26 Mar 1996 06:01:11 GMT, jmartin@cs.ucla.edu (Jay Martin) wrote:
  25.  
  26. >jhd@herold.franken.de (Joachim Durchholz) writes:
  27. >
  28. >>tej@world.std.com wrote 22.03.96 on Re: Portability of code & skills (Beware of "C" Hackers etc):
  29. >
  30. >>> I don't remember enough Pascal to know what you mean.  I know you could
  31. >>> define a function inside a function, making Pascal block-structured.
  32. >>> C can't do that, but of course you can pass functions as arguments of
  33. >>> functions.
  34. >
  35. >>The power of this mechanism is that the local function can access local  
  36. >>variables of its surrounding function. E.g. in a list processing  
  37. >>environment you could write
  38. >
  39. >>  function CountThem (l: List): integer;
  40. >>  var Count: integer
  41. >>    procedure CountOne (e: ListElement);
  42. >>    begin
  43. >>      if <some condition on e fulfilled> then begin
  44. >>        Count := Count + 1;
  45. >>      end;
  46. >>    end;
  47. >>  begin
  48. >>    ApplyOnList (l, CountOne); (* !!!! *)
  49. >>    CountThem := Count
  50. >>  end;
  51. >
  52. >
  53. >This is what I call side-effects on a global variable (or variable of
  54. >a larger scope).  Its not what I call good programming practice.  In
  55. >fact, I see nested procedures as implemented in algol block languages
  56. >(automatic importation of variables from larger scopes) as another
  57. >stupid idea of CS.  
  58. >
  59. >Jay
  60. >
  61. >
  62. >
  63. >
  64. >
  65.  
  66.